<?php
namespace app\common\model;

use think\Model;

class Article extends Model
{
	//protected $autoWriteTimestamp = true;//自动写时间
	public function add($data){
		$data['status'] = 1;
		//$data['create_time'] = time();
		return $this->save($data);
	}
	
	public function getNormalFirstArticle(){
		$data = [
			'status' => 1,
		];
		
		$order = [
			'id' => 'desc',
		];
		
		return $this->where($data)
			->order($order)
			->select();
	}
	
	public function getFirstArticle(){
		$data = [
			'status' => ['neq',-1],
		];
		
		$order = [
			'id' => 'desc',
		];
		$result = $this->where($data)
			->order($order)
			//->paginate(5,true);
			->select();
		//echo $this->getLastSql();
		
		return $result;
	}
}